namespace SharePoint.ImportExport.Core
{
    using System;
    using System.Text;
    using System.Text.RegularExpressions;

    /// <summary>
    /// This is a collection of helper functions
    /// </summary>
    public sealed class Miscallaneous
    {
        /// <summary>
        /// Helper function for removing characters not allowed in SharePoint. 
        /// </summary>
        /// <param name="toBeFixed">This is the string that will be fixed</param>
        /// <returns>A string that SharePoint acceps</returns>
        public static string FixName(string toBeFixed)
        {
            string pattern = @"[\\\?=:\]\[/\*\>\<\|&\%#~\x22\']";
            pattern = @"[\\\?=:\]\[\*\>\<\|&\%#~\x22\']";

            Regex regEx = new Regex(pattern);

            return regEx.Replace(toBeFixed, "_");
        }
    }
}
